package com.aabte.commons.ddd.shared;

/**
 * An entity, as explained in the DDD book.
 */
public interface ConcurrentDomainEntity<T, V, ID> extends DomainEntity<T, ID> {

    /**
     * Entities have an version.
     *
     * @return The version of this entity.
     */
    V version();

    /**
     * Entities compare by version, not by attributes.
     *
     * @param other The other entity.
     * @return true if the version are the same, regardles of other attributes.
     */
    boolean sameVersionAs(V other);
}
